<script setup>
import { onMounted } from 'vue'
import useWebSocket from '@/commons/websocket'

// 界面挂载前处理
onMounted(() => {
  const { isConnected, sendMessage } = useWebSocket('ws://127.0.0.1:8001/socket')
  setTimeout(() => {
    if (isConnected) {
      sendMessage('Hello, Server~!')
    }
  }, 2000)
})
</script>
<template><router-view /></template>
